package com.neusoft.news.service;


import java.util.ArrayList;
import java.util.List;

import com.neusoft.news.bean.User;
import com.neusoft.news.dao.UserDao;
import com.neusoft.news.dao.UserDaoImpl;


public class UserService {

	public User login(User user) throws Exception{
		User user1 = null;	
		UserDao userDao = new UserDaoImpl();
		user1 = userDao.getUser(user);
		return user1;
	}
	
	public boolean update(User user) throws Exception{
		boolean result = false;
		UserDao userDao = new UserDaoImpl();
		result = userDao.updateUser(user);
		return result;	
	}
	
	public boolean changepwd(User user) throws Exception{
		boolean result = false;
		UserDao userDao = new UserDaoImpl();
		result = userDao.changePwd(user);
		return result;	
	}
	
	public boolean insert(User user) throws Exception{
		boolean result = false;
		UserDao userDao = new UserDaoImpl();
		result = userDao.insertUser(user);
		return result;
	}
	
	public List<User> selectOldUser() throws Exception{
		List<User> users = new ArrayList<User>();
		UserDao userDao = new UserDaoImpl();
		users = userDao.selectOldUser();
		return users;
	}
	
	public boolean remove(int userid) throws Exception{
		boolean result = false;
		UserDao userDao = new UserDaoImpl();
		result = userDao.removeUser(userid);
		return result;
	}
	
	public List<User> selectNewUser() throws Exception{
		List<User> users = new ArrayList<User>();
		UserDao userDao = new UserDaoImpl();
		users = userDao.selectNewUser();
		return users;
	}
	
	public boolean shinsaUser(User user) throws Exception{
		boolean result = false;
		UserDao userDao = new UserDaoImpl();
		result = userDao.updateShinsa(user);
		return result;
		
	}
}
